﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>潜在客户管理</title>
    <#include "../common/link.ftl">
    <script>
        $(function () {



            $('.btn-input').click(function () {

                $('#editForm')[0].reset();

                var data = $(this).data('json');
                console.log(data);

                $('.modal-title').html("潜在客户添加")
                if (data) {
                    $('.modal-title').html("潜在客户编辑")
                    $('input[name="id"]').val(data.id)
                    $('input[name="name"]').val(data.name)
                    $('input[name="sn"]').val(data.sn)

                }


                $('#editModal').modal('show')
            })


            $('.btn-submit').click(function () {
                $('#editForm').ajaxSubmit(function (data) {
                    if (data.success) {
                        $.messager.confirm("温馨提示", data.msg, function () {
                            window.location.reload();
                        });
                    } else {
                        $.messager.alert("温馨提示", data.msg)
                    }
                })

            })

        })
    </script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#include "../common/navbar.ftl">
    <!--菜单回显-->
    <#assign currentMenu="customer_potential">
    <#include "../common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>潜在客户管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <form class="form-inline" id="searchForm" action="/customer/potentialList.do" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">

                    <div class="form-group">
                        <label for="keyword">关键字:</label>
                        <input type="text" class="form-control" id="keyword" name="keyword" value="${(qo.keyword)!}"
                               placeholder="请输入客户姓名/手机">
                    </div>
                   <#-- <@shiro.hasAnyRoles name ="Market_Manager">-->
                    <div class="form-group">
                        <label for="seller">销售人:</label>
                        <select id="seller" name="sellerId" class="form-control">
                            <option value="-1">请选择</option>
                            <#list  sellers as seller>
                                <option value="${seller.id}"<#if qo.sellerId==seller.id>selected</#if> >${seller.name}</option>
                            </#list>
                        </select>
                    </div>
                 <#--   </@shiro.hasAnyRoles>-->

                    <button id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span>
                        查询
                    </button>

                    <a class="btn btn-success btn-input " style="margin: 10px">
                        <span class="glyphicon glyphicon-plus "></span> 添加
                    </a>
                </form>
                <!--编写内容-->
                <div class="box-body table-responsive no-padding ">
                    <table class="table table-hover table-bordered">
                        <tr>
                            <th>编号</th>
                            <th>名字</th>
                            <th>年龄</th>
                            <th>性别</th>
                            <th>电话</th>
                            <th>qq</th>
                            <th>职业</th>
                            <th>来源</th>
                            <th>销售人</th>
                            <th>录入人</th>
                            <th>录入时间</th>
                            <th>客户状态</th>
                            <th>转正时间</th>
                            <th>操作</th>
                        </tr>


                        <#list pageInfo.list as customer>
                            <tr>
                                <td>${customer_index+1}</td>
                                <td>${customer.name}</td>
                                <td>${customer.age}</td>
                                <td>${customer.genderName}</td>
                                <td>${customer.tel}</td>
                                <td>${customer.qq}</td>
                                <td>${customer.job.title}</td>
                                <td>${customer.source.title}</td>
                                <td>${customer.seller.name}</td>
                                <td>${customer.inputUser.name}</td>
                                <td>${customer.inputTime?string('yyyy-MM-dd HH:mm:ss')}</td>
                                <td>${customer.statusName}</td>
                                <td>${(customer.positiveTime?string('yyyy-MM-dd HH:mm:ss'))!}</td>

                                <td>
                                    <a <#--data-json='${customer.jsonData}'--> class="btn btn-info btn-xs btn-input">
                                        <span class="glyphicon glyphicon-pencil"></span> 编辑
                                    </a>

                                </td>
                            </tr>
                        </#list>

                    </table>
                    <!--分页-->
                    <#include "../common/page.ftl">
                </div>
            </div>
        </section>
    </div>
    <#include "../common/footer.ftl">
</div>
<!---潜在客户编辑--->
<div class="modal fade" id="editModal">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">潜在客户添加</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="/customer/saveOrUpdate.do" method="post" id="editForm">
                    <input type="hidden" name="id">
                    <div class="form-group" >
                        <label  class="col-sm-3 control-label">名称：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control" name="name">
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-3 control-label">年龄：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control"  name="age">
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-3 control-label">性别：</label>
                        <div class="col-sm-6">
                            <select class="form-control" name="gender">
                                <option value="0">女</option>
                                <option value="1">男</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-3 control-label">电话：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control"  name="tel">
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-3 control-label">qq：</label>
                        <div class="col-sm-6">
                            <input type="text" class="form-control"  name="qq">
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-3 control-label">职业：</label>
                        <div class="col-sm-6">
                            <select class="form-control" name="job.id">
                  <#--  <#list jobs as job>
                        <option value="${job.id}">${job.title}</option>
                    </#list>-->
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label  class="col-sm-3 control-label">来源：</label>
                        <div class="col-sm-6">
                            <select class="form-control" name="source.id">
                   <#-- <#list sources as source>
                        <option value="${source.id}">${source.title}</option>
                    </#list>-->
                            </select>
                        </div>
                    </div>
                <#--<div class="form-group">
                    <label  class="col-sm-3 control-label">销售人：</label>
                    <div class="col-sm-6">
                        <select class="form-control" name="seller.id">
                             <#list sellers as seller>
                                 <option value="${seller.id}">${seller.name}</option>
                             </#list>
                        </select>
                    </div>
                </div>-->
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-primary btn-submit">保存</button>
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
            </div>
        </div>
    </div>
</div>
</body>
</html>
